<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libxlsxwriter: diagonal_border.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libxlsxwriter
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">diagonal_border.c</div>  </div>
</div><!--header-->
<div class="contents">
<table width="600">
<tr>
<td><a class="el" href="tab_colors_8c-example.html">&lt;&lt; tab_colors.c</a> </td><td align="right"><a class="el" href="hide_sheet_8c-example.html">hide_sheet.c &gt;&gt;</a>  </td></tr>
</table>
<p>Example of how to set a worksheet cell diagonal border.</p>
<div class="image">
<img src="diagonal_border.png" alt=""/>
</div>
<div class="fragment"><div class="line"><span class="comment">/*</span></div>
<div class="line"><span class="comment"> * A simple formatting example that demonstrates how to add diagonal</span></div>
<div class="line"><span class="comment"> * cell borders using the libxlsxwriter library.</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> * Copyright 2014-2020, John McNamara, jmcnamara@cpan.org</span></div>
<div class="line"><span class="comment"> *</span></div>
<div class="line"><span class="comment"> */</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &quot;xlsxwriter.h&quot;</span></div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> </div>
<div class="line">    <span class="comment">/* Create a new workbook and add a worksheet. */</span></div>
<div class="line">    <a name="_a0"></a><a class="code" href="structlxw__workbook.html">lxw_workbook</a>  *workbook  = <a name="a1"></a><a class="code" href="workbook_8h.html#a1cf96608a23ee4eb0e8467c15240d00b">workbook_new</a>(<span class="stringliteral">&quot;diagonal_border.xlsx&quot;</span>);</div>
<div class="line">    <a name="_a2"></a><a class="code" href="structlxw__worksheet.html">lxw_worksheet</a> *worksheet = <a name="a3"></a><a class="code" href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a>(workbook, NULL);</div>
<div class="line"> </div>
<div class="line">    <span class="comment">/* Add some diagonal border formats. */</span></div>
<div class="line">    <a name="_a4"></a><a class="code" href="structlxw__format.html">lxw_format</a> *format1 = <a name="a5"></a><a class="code" href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33">workbook_add_format</a>(workbook);</div>
<div class="line">    <a name="a6"></a><a class="code" href="format_8h.html#a1bd8ade5206d187f4f790dbb004ca129">format_set_diag_type</a>(  format1, <a name="a7"></a><a class="code" href="format_8h.html#add9c45d94b8c1d29e69b37278384fae2a6a89bbf04376eb234e9d21c58cf4bbb3">LXW_DIAGONAL_BORDER_UP</a>);</div>
<div class="line"> </div>
<div class="line">    <a class="code" href="structlxw__format.html">lxw_format</a> *format2 = <a class="code" href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33">workbook_add_format</a>(workbook);</div>
<div class="line">    <a class="code" href="format_8h.html#a1bd8ade5206d187f4f790dbb004ca129">format_set_diag_type</a>(  format2, <a name="a8"></a><a class="code" href="format_8h.html#add9c45d94b8c1d29e69b37278384fae2a6f8e8c0f88fb619742db3694d65c8d88">LXW_DIAGONAL_BORDER_DOWN</a>);</div>
<div class="line"> </div>
<div class="line">    <a class="code" href="structlxw__format.html">lxw_format</a> *format3 = <a class="code" href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33">workbook_add_format</a>(workbook);</div>
<div class="line">    <a class="code" href="format_8h.html#a1bd8ade5206d187f4f790dbb004ca129">format_set_diag_type</a>(  format3, <a name="a9"></a><a class="code" href="format_8h.html#add9c45d94b8c1d29e69b37278384fae2ac9cfa140f5f9960014d4d46e1099a6ba">LXW_DIAGONAL_BORDER_UP_DOWN</a>);</div>
<div class="line"> </div>
<div class="line">    <a class="code" href="structlxw__format.html">lxw_format</a> *format4 = <a class="code" href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33">workbook_add_format</a>(workbook);</div>
<div class="line">    <a class="code" href="format_8h.html#a1bd8ade5206d187f4f790dbb004ca129">format_set_diag_type</a>(  format4, <a class="code" href="format_8h.html#add9c45d94b8c1d29e69b37278384fae2ac9cfa140f5f9960014d4d46e1099a6ba">LXW_DIAGONAL_BORDER_UP_DOWN</a>);</div>
<div class="line">    <a name="a10"></a><a class="code" href="format_8h.html#a60a053a40e1e70d5ad4a6171458a360a">format_set_diag_border</a>(format4, <a name="a11"></a><a class="code" href="format_8h.html#a4d5e924b1acd9571fd5e0fe2615e9f8fae7797837ba422a1906eae45fc70c433b">LXW_BORDER_HAIR</a>);</div>
<div class="line">    <a name="a12"></a><a class="code" href="format_8h.html#abfffdfb19f1c5bf6ad95a1b40cec2d35">format_set_diag_color</a>( format4, <a name="a13"></a><a class="code" href="format_8h.html#abeafc6e8222ba9fcfd4f2c2f4e9ea38baedd7412491d9f34fc5f947ada9d196ec">LXW_COLOR_RED</a>);</div>
<div class="line"> </div>
<div class="line">    <a name="a14"></a><a class="code" href="worksheet_8h.html#ac208046e7a6d12cc87982422efa41b31">worksheet_write_string</a>(worksheet, <a name="a15"></a><a class="code" href="utility_8h.html#ad510ac6df573d23203374e24dba373d2">CELL</a>(<span class="stringliteral">&quot;B3&quot;</span>),  <span class="stringliteral">&quot;Text&quot;</span>, format1);</div>
<div class="line">    <a class="code" href="worksheet_8h.html#ac208046e7a6d12cc87982422efa41b31">worksheet_write_string</a>(worksheet, <a class="code" href="utility_8h.html#ad510ac6df573d23203374e24dba373d2">CELL</a>(<span class="stringliteral">&quot;B6&quot;</span>),  <span class="stringliteral">&quot;Text&quot;</span>, format2);</div>
<div class="line">    <a class="code" href="worksheet_8h.html#ac208046e7a6d12cc87982422efa41b31">worksheet_write_string</a>(worksheet, <a class="code" href="utility_8h.html#ad510ac6df573d23203374e24dba373d2">CELL</a>(<span class="stringliteral">&quot;B9&quot;</span>),  <span class="stringliteral">&quot;Text&quot;</span>, format3);</div>
<div class="line">    <a class="code" href="worksheet_8h.html#ac208046e7a6d12cc87982422efa41b31">worksheet_write_string</a>(worksheet, <a class="code" href="utility_8h.html#ad510ac6df573d23203374e24dba373d2">CELL</a>(<span class="stringliteral">&quot;B12&quot;</span>), <span class="stringliteral">&quot;Text&quot;</span>, format4);</div>
<div class="line"> </div>
<div class="line">    <a name="a16"></a><a class="code" href="workbook_8h.html#ad9e7aeebc0fd43562db5bcd527b2ee5e">workbook_close</a>(workbook);</div>
<div class="line"> </div>
<div class="line">    <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
</div><!-- fragment --> </div><!-- contents -->
<div class="ttc" id="aworkbook_8h_html_ad9e7aeebc0fd43562db5bcd527b2ee5e"><div class="ttname"><a href="workbook_8h.html#ad9e7aeebc0fd43562db5bcd527b2ee5e">workbook_close</a></div><div class="ttdeci">lxw_error workbook_close(lxw_workbook *workbook)</div><div class="ttdoc">Close the Workbook object and write the XLSX file.</div></div>
<div class="ttc" id="aformat_8h_html_add9c45d94b8c1d29e69b37278384fae2a6f8e8c0f88fb619742db3694d65c8d88"><div class="ttname"><a href="format_8h.html#add9c45d94b8c1d29e69b37278384fae2a6f8e8c0f88fb619742db3694d65c8d88">LXW_DIAGONAL_BORDER_DOWN</a></div><div class="ttdeci">@ LXW_DIAGONAL_BORDER_DOWN</div><div class="ttdef"><b>Definition:</b> format.h:172</div></div>
<div class="ttc" id="aworkbook_8h_html_a1cf96608a23ee4eb0e8467c15240d00b"><div class="ttname"><a href="workbook_8h.html#a1cf96608a23ee4eb0e8467c15240d00b">workbook_new</a></div><div class="ttdeci">lxw_workbook * workbook_new(const char *filename)</div><div class="ttdoc">Create a new workbook object.</div></div>
<div class="ttc" id="aformat_8h_html_add9c45d94b8c1d29e69b37278384fae2a6a89bbf04376eb234e9d21c58cf4bbb3"><div class="ttname"><a href="format_8h.html#add9c45d94b8c1d29e69b37278384fae2a6a89bbf04376eb234e9d21c58cf4bbb3">LXW_DIAGONAL_BORDER_UP</a></div><div class="ttdeci">@ LXW_DIAGONAL_BORDER_UP</div><div class="ttdef"><b>Definition:</b> format.h:169</div></div>
<div class="ttc" id="aformat_8h_html_a60a053a40e1e70d5ad4a6171458a360a"><div class="ttname"><a href="format_8h.html#a60a053a40e1e70d5ad4a6171458a360a">format_set_diag_border</a></div><div class="ttdeci">void format_set_diag_border(lxw_format *format, uint8_t style)</div><div class="ttdoc">Set the diagonal cell border style.</div></div>
<div class="ttc" id="astructlxw__worksheet_html"><div class="ttname"><a href="structlxw__worksheet.html">lxw_worksheet</a></div><div class="ttdoc">Struct to represent an Excel worksheet.</div><div class="ttdef"><b>Definition:</b> worksheet.h:1603</div></div>
<div class="ttc" id="astructlxw__format_html"><div class="ttname"><a href="structlxw__format.html">lxw_format</a></div><div class="ttdoc">Struct to represent the formatting properties of an Excel format.</div><div class="ttdef"><b>Definition:</b> format.h:358</div></div>
<div class="ttc" id="aformat_8h_html_a4d5e924b1acd9571fd5e0fe2615e9f8fae7797837ba422a1906eae45fc70c433b"><div class="ttname"><a href="format_8h.html#a4d5e924b1acd9571fd5e0fe2615e9f8fae7797837ba422a1906eae45fc70c433b">LXW_BORDER_HAIR</a></div><div class="ttdeci">@ LXW_BORDER_HAIR</div><div class="ttdef"><b>Definition:</b> format.h:313</div></div>
<div class="ttc" id="aformat_8h_html_add9c45d94b8c1d29e69b37278384fae2ac9cfa140f5f9960014d4d46e1099a6ba"><div class="ttname"><a href="format_8h.html#add9c45d94b8c1d29e69b37278384fae2ac9cfa140f5f9960014d4d46e1099a6ba">LXW_DIAGONAL_BORDER_UP_DOWN</a></div><div class="ttdeci">@ LXW_DIAGONAL_BORDER_UP_DOWN</div><div class="ttdef"><b>Definition:</b> format.h:175</div></div>
<div class="ttc" id="astructlxw__workbook_html"><div class="ttname"><a href="structlxw__workbook.html">lxw_workbook</a></div><div class="ttdoc">Struct to represent an Excel workbook.</div><div class="ttdef"><b>Definition:</b> workbook.h:273</div></div>
<div class="ttc" id="aformat_8h_html_a1bd8ade5206d187f4f790dbb004ca129"><div class="ttname"><a href="format_8h.html#a1bd8ade5206d187f4f790dbb004ca129">format_set_diag_type</a></div><div class="ttdeci">void format_set_diag_type(lxw_format *format, uint8_t type)</div><div class="ttdoc">Set the diagonal cell border type.</div></div>
<div class="ttc" id="aformat_8h_html_abfffdfb19f1c5bf6ad95a1b40cec2d35"><div class="ttname"><a href="format_8h.html#abfffdfb19f1c5bf6ad95a1b40cec2d35">format_set_diag_color</a></div><div class="ttdeci">void format_set_diag_color(lxw_format *format, lxw_color_t color)</div><div class="ttdoc">Set the diagonal cell border color.</div></div>
<div class="ttc" id="aworksheet_8h_html_ac208046e7a6d12cc87982422efa41b31"><div class="ttname"><a href="worksheet_8h.html#ac208046e7a6d12cc87982422efa41b31">worksheet_write_string</a></div><div class="ttdeci">lxw_error worksheet_write_string(lxw_worksheet *worksheet, lxw_row_t row, lxw_col_t col, const char *string, lxw_format *format)</div><div class="ttdoc">Write a string to a worksheet cell.</div></div>
<div class="ttc" id="aformat_8h_html_abeafc6e8222ba9fcfd4f2c2f4e9ea38baedd7412491d9f34fc5f947ada9d196ec"><div class="ttname"><a href="format_8h.html#abeafc6e8222ba9fcfd4f2c2f4e9ea38baedd7412491d9f34fc5f947ada9d196ec">LXW_COLOR_RED</a></div><div class="ttdeci">@ LXW_COLOR_RED</div><div class="ttdef"><b>Definition:</b> format.h:217</div></div>
<div class="ttc" id="autility_8h_html_ad510ac6df573d23203374e24dba373d2"><div class="ttname"><a href="utility_8h.html#ad510ac6df573d23203374e24dba373d2">CELL</a></div><div class="ttdeci">#define CELL(cell)</div><div class="ttdoc">Convert an Excel A1 cell string into a (row, col) pair.</div><div class="ttdef"><b>Definition:</b> utility.h:45</div></div>
<div class="ttc" id="aworkbook_8h_html_a81d456b4f65a464e78e4a0030ecc3c2e"><div class="ttname"><a href="workbook_8h.html#a81d456b4f65a464e78e4a0030ecc3c2e">workbook_add_worksheet</a></div><div class="ttdeci">lxw_worksheet * workbook_add_worksheet(lxw_workbook *workbook, const char *sheetname)</div><div class="ttdoc">Add a new worksheet to a workbook.</div></div>
<div class="ttc" id="aworkbook_8h_html_a279a5d7075d09a3931aae9782afede33"><div class="ttname"><a href="workbook_8h.html#a279a5d7075d09a3931aae9782afede33">workbook_add_format</a></div><div class="ttdeci">lxw_format * workbook_add_format(lxw_workbook *workbook)</div><div class="ttdoc">Create a new Format object to formats cells in worksheets.</div></div>
<!-- HTML footer for doxygen 1.8.20-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Copyright 2014-2020 John McNamara.
Generated by&#160;<a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.8.20
</small></address>
</body>
</html>
